package com.photobucket.webapi.oauth
{

        import flexunit.framework.TestCase;
        import flexunit.framework.TestSuite;
        import flash.net.URLVariables;

		public class OAuthRequestTest extends TestCase {

			public function OAuthRequestTest(methodName:String = null) {
				super(methodName);
			}

			public function testParameters():void {
				var request:OAuthRequest = new OAuthRequest();
				request.addParameter("zxyz", "value");
				request.addParameter("zzyz", "value");
				request.addParameter("abc", "abc123");
				var paramString:String = request.parameterString;
				assertEquals("Param String Sorted Correctly", paramString, "abc=abc123&zxyz=value&zzyz=value");
				request.addParameter("needEncode", "something/some thing");
				paramString = request.parameterString;
				assertEquals("Paramesters Sorted and Encoded Correctly", paramString, "abc=abc123&needEncode=something%2Fsome%20thing&zxyz=value&zzyz=value");				
				var variables:URLVariables = request.urlVariables;
				assertEquals("Variable Exits and Correct Value", variables.needEncode, "something/some thing");
				assertEquals("Variable Exists and Correct Value", variables.abc, "abc123");
				assertEquals("Variable Exists and Correct Value", variables.zxyz, "value");
				assertEquals("Variable Exists and Correct Value", variables.zzyz, "value");
			}

			public function testDefaults():void {
				var request:OAuthRequest = new OAuthRequest();
				assertFalse("Default needsLogin to false", request.needsLogin);
				assertEquals("Default method to get", request.method, "GET");
			}


		}
}